package com.yz.xyt.mapper;

import com.yz.xyt.domain.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface RoleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    int insertSelective(Role record);

    Role selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    int addUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);

    List<String> selectUserRoles(Long userId);

    /**
     * 查询岗位对应的角色
     * @param postNumber
     * @return
     */
    Role selectRoleByPostNumber(String postNumber);

    /**
     * 删除用户角色
     * @param userId
     * @return
     */
    int deleteUserRole(Long userId);

    String findRoleIdByName(String roleName);

    /**
     * 更新用户角色
     * @param userId
     * @param roleId
     * @return
     */
    int updateUserRole(@Param("userId") Long userId, @Param("roleId") String roleId);
}